
MYBASE = /usr/local/mysql

CC = gcc

CFLAGS = -Wall -Werror
CFLAGS += `pkg-config libdaemon --cflags`
CFLAGS += `net-snmp-config --cflags`
CFLAGS += `$(MYBASE)/bin/mysql_config --cflags` -I$(MYBASE)/include/storage/ndb

LDFLAGS = -lpthread
LDFLAGS += `pkg-config libdaemon --libs`
LDFLAGS += `net-snmp-config --agent-libs`
LDFLAGS += `$(MYBASE)/bin/mysql_config --libs_r` -lndbclient

OUTPUT = ndb_snmpd
OBJ = src/ndb_snmpd.o src/common.o src/config.o src/thread.o src/ndb_mgm.o src/subagent.o

.PHONY: all
all: $(OUTPUT)

.PHONY: deps
deps:
	apt-get -y install libsnmp-dev libdaemon-dev snmp-mibs-downloader

$(OUTPUT): $(OBJ)
	$(CC) -o $(OUTPUT) $(OBJ) $(LDFLAGS)

.c.o: $<
	$(CC) -o $@ -c $< $(CFLAGS)

.PHONY: clean
clean:
	rm -f $(OUTPUT) $(OBJ)

